package com.xzr.hospitalregister.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.xzr.hospitalregister.service.MyService;

/**
 * Created by Administrator on 2018/2/5 0005.
 */

public class MyReceiver extends BroadcastReceiver{
    @Override
    public void onReceive(Context context, Intent intent) {
//        intent.getStringExtra("text1");
        //后边的XXX.class就是要启动的服务
        Intent service = new Intent(context, MyService.class);
        service.putExtra("text1",intent.getStringExtra("text1"));
        context.startService(service);
        Log.v("TAG", "显示在广播中的语音内容....."+intent.getStringExtra("text1"));
//        //启动应用，参数为需要自动启动的应用的包名
//        Intent intent = getPackageManager().getLaunchIntentForPackage(packageName);
//        context.startActivity(intent );
    }
}
